import java.util.Arrays;
import java.util.Random;

public class Test {
    public static void testquicksort1(int[] array) {
        int[] array2=array.clone();
        long start=System.currentTimeMillis();
        QuickSort2.quickSort1(array2);
        long end=System.currentTimeMillis();
        System.out.println("快速排序1："+(end-start)+"ms");
    }
    public static void testquicksort2(int[] array) {
        int[] array2=array.clone();
        long start=System.currentTimeMillis();
        QuickSort2.quickSort2(array2);
        long end=System.currentTimeMillis();
        System.out.println("快速排序2："+(end-start)+"ms");
    }
    public static void testshellSort(int[] array) {
        int[] array2=array.clone();
        long start=System.currentTimeMillis();
        Sort2.shellSort(array2);
        long end=System.currentTimeMillis();
        System.out.println("希尔排序："+(end-start)+"ms");
    }
    public static void testmergeSort(int[] array) {
        int[] array2=array.clone();
        long start=System.currentTimeMillis();
        Sort3.mergeSort(array2);
        long end=System.currentTimeMillis();
        System.out.println("归并排序："+(end-start)+"ms");
    }
    public static void testheapSort(int[] array) {
        int[] array2=array.clone();
        long start=System.currentTimeMillis();
        Sort2.heapSort(array2);
        long end=System.currentTimeMillis();
        System.out.println("堆排序："+(end-start)+"ms");
    }
    public static void testinsertsort(int[] array) {
        int[] array2=array.clone();
        long start=System.currentTimeMillis();
        Sort2.insertSort(array2);
        long end=System.currentTimeMillis();
        System.out.println("插入排序："+(end-start)+"ms");
    }
    public static void main(String[] args) {
        int[] array=new int[1000_0000];
        inooderarray(array);
        testheapSort(array);
        testmergeSort(array);
        testquicksort1(array);
        testquicksort2(array);
        testshellSort(array);
        }
    public static void inooderarray(int[] array){
        int length=array.length;
        System.out.println("记录长度："+length);
        Random random=new Random();
        for(int i=0;i<array.length;i++){
            array[i] = random.nextInt(length);
          }
    }
}


